//
// Created by wze-zero on 2024/9/8 008.
//
#include <iostream>

using namespace std;

int main() {
    int y, m, d, y1, m1, d1;
    cin >> y >> m >> d;
    cin >> y1 >> m1 >> d1;
    if (y > y1) {
        cout << "no" << endl;
    } else if (y < y1) {
        cout << "yes" << endl;
    } else {
        if (m > m1) {
            cout << "no" << endl;
        } else if (m < m1) {
            cout << "yes" << endl;
        } else {
            if (d > d1) {
                cout << "no" << endl;
            } else {
                cout << "yes" << endl;
            }
        }
    }
    return 0;
}